package com.bolt.core.view.templates;

import com.bolt.common.BoltConstants;

/**
 * Created by Administrator on 2017/8/29.
 */

public class Template implements Cloneable {
    String dir;
    String theme;
    String name;

    public Template(String dir, String theme, String name) {
        this.dir = dir;
        this.theme = theme;
        this.name = name;
    }

    public Template(String name) {

        this.dir = BoltConstants.DEFAULT_BOLT_UI_TEMPLATEDIR;
        this.theme = BoltConstants.DEFAULT_BOLT_UI_THEME;
        this.name = name;
    }

    public String getDir() {
        return dir;
    }

    public String getTheme() {
        return theme;
    }

    public String getName() {
        return name;
    }

    @Override
    public String toString() {
        return new StringBuilder("/").append(theme).append("/").append(name).toString();
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        Template template = (Template) o;

        if (dir != null ? !dir.equals(template.dir) : template.dir != null) {
            return false;
        }
        if (name != null ? !name.equals(template.name) : template.name != null) {
            return false;
        }
        if (theme != null ? !theme.equals(template.theme) : template.theme != null) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int result = dir != null ? dir.hashCode() : 0;
        result = 31 * result + (theme != null ? theme.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        return result;
    }

}
